// 基于 SnowLang Project (https://gitee.com/jcnc-org/snow) 的衍生作品
// 原始版权归属: Copyright © 2025 Ke Xu (Luke)
// 本实现版权归属: Copyright © 2025 Sany
// 遵循 Apache License 2.0 授权
package task

import (
	"errors"

	"gitee.com/xntk2381/cc/vm"
)

type RunTask struct {
	Args []string
}

func NewRunTask(args []string) *RunTask {
	return &RunTask{
		Args: args,
	}
}

func (t *RunTask) Run() error {
	// 检查参数数量
	if len(t.Args) == 0 {
		return errors.New("VM run requires at least the program file path.")
	}
	vm.VMLauncher.Main(t.Args)

	return nil
}
